1. Field of the Invention
The present invention relates to an image processing apparatus, a method of controlling the same, a distance measurement apparatus, and a storage medium and, more particularly, to an image processing apparatus for reducing influence of noise generated by multiple reflection that occurs due to the surface property, shape, and arrangement of image capturing target objects, a method of controlling the same, a distance measurement apparatus, and a storage medium.
2. Description of the Related Art
When the glossiness of image capturing target objects is high, and their shapes and arrangement are complex, a plurality of number of times of reflection, that is, multiple reflection occurs between the image capturing target objects. The multiple reflection occurs between image capturing targets and is therefore also called mutual reflection. When multiple reflection occurs, a ghost image that should be absent among the image capturing target objects is generated. When image processing is applied to such a captured image, the ghost image appears as noise. Hence, a problem may be posed by the malfunction of image processing.
Especially, in a pattern projection method that uses pattern light to measure the distance of an image capturing target object, the influence of the ghost image is conspicuous. The principle of the pattern projection method will be described first, and the influence will then be described.
In the pattern projection method, the three-dimensional distance of a measurement target object is calculated by triangulation based on the output angle of pattern light from an illumination apparatus, the incident angle of the pattern light that is reflected by the measurement target object and becomes incident on an image capturing apparatus, and the distance between the illumination apparatus and the image capturing apparatus. The incident angle of the image capturing apparatus can easily be obtained by calibrating the corresponding relationship between the incident angle and the pixel coordinates of the image sensor. Various methods such as a light-section method and a spatial encoding method have been proposed to obtain the output angle of pattern light.
In the spatial encoding method, pattern light formed from a plurality of line light components is projected onto a measurement target object. The line numbers of the plurality of line light components are identified by various encoding methods. As the encoding methods for identifying the line numbers, a gray code method, a rainbow method, and the like are known. In the gray code method, binary pattern light components having different periods are sequentially projected. The line numbers are identified using encoding in the temporal direction. The output angle can be obtained because the output angle and the line numbers are calibrated in advance.
In the pattern projection method, under the condition that the measurement target objects have a high surface scattering property and simple shapes and arrangement, 1st-order reflected light is dominant in the light reflected by the measurement target objects, and the processing effectively functions. However, under the condition that the measurement target objects have a high glossiness and complex shapes and arrangement, multiple reflection occurs between the measurement target objects. When multiple reflection occurs, the light is reflected to an angle different from the output angle of light from the projection apparatus. When the multiple reflected light becomes incident on the image capturing apparatus, the output angle of the light beam is erroneously detected, resulting in an error in distance measurement.
A related art for this problem is a method described in Japanese Patent No. 3800842. Japanese Patent No. 3800842 discloses a method using the property of reflection that causes inversion of an image. That is, since the increase/decrease in the line number is inverted in a region where multiple reflected light is generated, a multiple reflected light region is detected based on it.
The method described in Japanese Patent No. 3800842 can detect a measurement error caused by an even number of times of multiple reflection but not a measurement error caused by an odd number of times of multiple reflection. Additionally, an error may occur upon determining a region where both 1st-order reflected light and multiple reflected light exist. If a measurement target object has a step shape, the increase/decrease in the line number may be inverted even without reflection. As described above, there has not been proposed any distance measurement technique capable of effectively detecting a region where multiple reflection between measurement target objects occurs.
In consideration of the above-described problems, the present invention provides a technique of reducing the influence of noise generated by multiple reflection by detecting a multiple reflected light region using pattern projection and simple image processing.